package com.dayaokeji.rhythmschoolstudent.databases;

import android.content.Context;

import com.litesuits.orm.BuildConfig;
import com.litesuits.orm.LiteOrm;
import com.litesuits.orm.db.DataBaseConfig;

/**
 * Created by Gorden on 2017/9/27.
 */

public class LiteOrmUtils {

    private static final String DATABASE_NAME = "rhythmschool";
    private static final int DATABASE_VERSION = 2;

    static LiteOrm liteOrm;

    public static LiteOrm getLiteOrm(Context context) {
        if (liteOrm == null) {
            DataBaseConfig dataBaseConfig = new DataBaseConfig(context, DATABASE_NAME);
            dataBaseConfig.debugged = BuildConfig.DEBUG;
            dataBaseConfig.dbVersion = DATABASE_VERSION;
            liteOrm = LiteOrm.newCascadeInstance(dataBaseConfig);
        }
        return liteOrm;
    }
}
